package com.winshare.saleAssistant.controller;


import com.winshare.saleAssistant.domain.dto.req.*;
import com.winshare.saleAssistant.service.StatisticsService;
import com.winshare.saleAssistant.util.LogicResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sys/statistics")
@CrossOrigin
@Api(value = "统计分析", description = "统计分析")
public class StatisticsController {

    private final StatisticsService statisticsService;

    public StatisticsController(StatisticsService statisticsService) {
        this.statisticsService = statisticsService;
    }

    @PostMapping("/num1")
    @ApiOperation(value = "获取累计激活用户和总用户数", notes = "获取累计激活用户和总用户数")
    public LogicResponse getActiveStaffAndTotalStaffAmount(@RequestBody @Validated StatisticReq1DTO statisticReq1) {
        return LogicResponse.success(statisticsService.getActiveStaffAndTotalStaffAmount(statisticReq1));
    }

    @PostMapping("/num2")
    @ApiOperation(value = "内容阅读次数,产品外部资料阅读,产品内部资料阅读,产品转发,提交案例次数",
                                              notes = "内容阅读次数,产品外部资料阅读,产品内部资料阅读,产品转发,提交案例次数")
    public LogicResponse getNum2(@RequestBody @Validated StatisticReq1DTO statisticReq1DTO) {
        return LogicResponse.success(statisticsService.getNum2(statisticReq1DTO));
    }

    @PostMapping("/num3")
    @ApiOperation(value = "市/分公司使用情況",notes = "市/分公司使用情況")
    public LogicResponse getNum3(@RequestBody @Validated StatisticReq3DTO statisticReq3DTO) {
        return LogicResponse.success(statisticsService.getOrgUsage(statisticReq3DTO));
    }

    @PostMapping("/num4")
    @ApiOperation(value = "产品关注情况",notes = "产品关注情况")
    public LogicResponse getNum4(@RequestBody @Validated StatisticReq4DTO statisticReq4DTO) {
        return LogicResponse.success(statisticsService.getProductFocusInfo(statisticReq4DTO));
    }

    @PostMapping("/num5")
    @ApiOperation(value = "文章阅读排名",notes = "文章阅读排名")
    public LogicResponse getNum5(@RequestBody @Validated StatisticReq5DTO statisticReq5DTO) {
        return LogicResponse.success(statisticsService.getArticleReadOrder(statisticReq5DTO));
    }

    @PostMapping("/num6")
    @ApiOperation(value = "用户使用排名",notes = "用户使用排名")
    public LogicResponse getNum6(@RequestBody @Validated StatisticReq6DTO statisticReq6DTO) {
        return LogicResponse.success(statisticsService.getStaffUsageOrder(statisticReq6DTO));
    }

}
